create or replace view vac_label_templates_4_1 as
with tl as
(
 select
   workspace,
   workspace_display_name,
   application_id,
   application_name,
   theme_number,
   theme_class,
   template_name,
   before_label,
   after_label,
   before_item,
   after_item,
   is_subscribed,
   subscribed_from,
   on_error_before_label,
   on_error_after_label,
   last_updated_on,
   last_updated_by,
   translate_this_template,
   component_comment,
   label_template_id,
   component_signature
  from APEX_APPLICATION_TEMP_LABEL t
)
select
   workspace,
   workspace_display_name,
   application_id,
   application_name,
   theme_number,
   theme_class,
   template_name,
   last_updated_on,
   last_updated_by,
   label_template_id,
   'APEX_APPLICATION_TEMP_LABEL' src_view_name,
   u_name,
   u_value
from tl
UNPIVOT INCLUDE NULLS
( u_value FOR u_name IN
 (
   before_label,
   after_label,
   before_item,
   after_item,
   is_subscribed,
   subscribed_from,
   on_error_before_label,
   on_error_after_label,
   translate_this_template,
   component_comment
 )
);

